<extend name="Public/base" />

<block name="body">
	<style type="text/css">
	.t-c{text-align:center;}
	.data-table thead th{text-align:center;}
	.data-table thead th, .data-table tbody td{text-align:center;}
	</style>
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>报备记录</h2>
	</div> 
	<div class="cf">
		<div class="fl">  
            <a href="{:U('index')}"><button class="btn" style='color: #fdfdfd;background-color: #3986bd;'>全部记录</button></a>   
        </div>
        <!-- 高级搜索 -->
		<div class="search-form fr cf"> 
			<form id='sform'>

			<div class="sleft"> 
				<select name="project_id" id="projectId" style='float:left'> 
					<option value="">&nbsp;选择项目&nbsp;</option> 
					<volist name='projectList' id='pv'>
						<option <?php if($pv['id']==I('projectId')) echo 'selected="selected"';?> value="{$pv.id}">&nbsp;{$pv.title}&nbsp;</option>
					</volist>
				</select>
			</div>
			<div class="sleft"> 
				<select name="status" id="status" style='float:left'> 
					<option value="all" <?php if($vst=='all') echo 'selected="selected"';?> >&nbsp;所有状态&nbsp;</option> 
					<option value="0" <?php if($vst=='0') echo 'selected="selected"';?>>&nbsp;待审核&nbsp;</option> 
					<option value="1" <?php if($vst=='1') echo 'selected="selected"';?>>&nbsp;已通过&nbsp;</option> 
					<option value="2" <?php if($vst=='2') echo 'selected="selected"';?>>&nbsp;已到访&nbsp;</option>  
					<option value="3" <?php if($vst=='3') echo 'selected="selected"';?>>&nbsp;已失效&nbsp;</option>  
					<option value="4" <?php if($vst=='4') echo 'selected="selected"';?>>&nbsp;已成交&nbsp;</option>   
				</select>
			</div>
			<div class="sleft">  
				<input type="text" name="keywords" class="search-input" value="{:I('keywords')}" placeholder="请输入客户姓名或电话"> 
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
			</div> 
			</form>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">ID</th> 
		<th class="">报备人</th>  
		<th class="">项目名称</th>  
		<th class="">客户姓名</th>  
		<th class="">客户电话</th>  
		<th class="">项目佣金</th> 
		<th class="">经纪人公司</th> 
		<th class="">经纪人姓名</th> 
		<th class="">经纪人电话</th> 
		<th class="">状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list"> 
		<volist name="_list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>  
			<td>
				<?php $uinfo=M('member')->find($vo['uid']);?>
				<p class='t-c'><img src="{$uinfo.avatar}" style="width:50px;height:50px;border-radius:25px;"></p>
				<p class='t-c'>{$uinfo.nickname}</p>
			</td>  
			<td>{$vo.project_title}</td>    
			<td>{$vo.name}</td>    
			<td>{$vo.tel}</td>    
			<td>{$vo.yongjin}</td> 
			<td>{$vo.jjcompany}</td> 
			<td>{$vo.jjname}</td> 
			<td>{$vo.jjtel}</td> 
			<td>
				<?php if($vo['status']==0) echo '待审核';elseif($vo['status']==1) echo '<font color="green">已通过</font>';elseif($vo['status']==-1) echo '<font color="red">已拒绝</font>';elseif($vo['status']==2) echo '<font color="blue">已到访</font>';elseif($vo['status']==3) echo '<font color="gray">已失效</font>';elseif($vo['status']==4) echo '<font color="green">已成交</font>';?>
			</td>
			<td> 
				<eq name="vo.status" value="0">
					<a href="{:U('changeStatus?status=1&id='.$vo['id'])}" class="ajax-get">通过申请</a> 
					<a href="{:U('changeStatus?status=-1&id='.$vo['id'])}" class="ajax-get">拒绝申请</a>
				</eq>
				<?php if($vo['status']>=1):?>
					<a href="{:U('changeStatus?status=2&id='.$vo['id'])}" class="ajax-get">已到访</a> 
					<a href="{:U('changeStatus?status=3&id='.$vo['id'])}" class="ajax-get">已失效</a>
					<a href="{:U('changeStatus?status=4&id='.$vo['id'])}" class="ajax-get">已成交</a>
				<?php endif;?>
				<a href="{:U('del?status=1&ids='.$vo['id'])}" class="ajax-get confirm" style='color:gray;'>删除</a> 
            </td>
		</tr>
		</volist>
		<else/>
		<td colspan="11" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript"> 
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('#sform').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
    //导航高亮
    highlight_subnav('{:U('index')}'); 
	</script>
</block>
